#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
int main()
{
	int i = 0;
	for (i = 0; i < 100000; i++)
	{
		double sum = 0.0;
		int count = 0;
		int temp = i;
		while (temp != 0)
		{
			temp = temp / 10;
			count++;
		}
		temp = i;
		while (temp != 0)
		{
			sum += pow((temp % 10), count);
			temp /= 10;
		}

		if (sum == i)
		{
			printf("%d ", i);
		}
	}
	return 0;
}